﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:properties="clr-namespace:ViewOn.Properties"
	xmlns:ViewOn="clr-namespace:ViewOn.UI.Control"
	xmlns:wpf="clr-namespace:ViewOnCore.Helper.WPF;assembly=ViewOnCore"
    xmlns:host="clr-namespace:ViewOnCore.HostContract;assembly=ViewOnCore">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="..\Shared.xaml" />
	</ResourceDictionary.MergedDictionaries>

	<Style x:Key="{x:Type ViewOn:SkinWindow}" TargetType="{x:Type ViewOn:SkinWindow}">
		<Setter Property="FocusVisualStyle" Value="{x:Null}" />
		<Setter Property="Template">
			<Setter.Value>

				<ControlTemplate TargetType="{x:Type ViewOn:SkinWindow}">

					<Grid Name="ThisWindow" Background="{DynamicResource VOBackgroundColor}">
						<Grid.RowDefinitions>
							<RowDefinition Height="25" />
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>

						<Grid.Resources>
							<Storyboard x:Key="SetSkinMouseInactive">
								<Storyboard>
									<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="headerBar" />
									<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="minimize" />
									<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="maximize" />
									<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="close" />
									<DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="windowBorder" />
								</Storyboard>
							</Storyboard>

							<Storyboard x:Key="SetSkinMouseActive">
								<Storyboard>
									<DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="headerBar" />
									<DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="minimize" />
									<DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="maximize" />
									<DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="close" />
									<DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="windowBorder" />
								</Storyboard>
							</Storyboard>
						</Grid.Resources>

						<!-- Animated background -->
						<Grid Grid.RowSpan="2" x:Name="griBackgroundHolder">
							<Image Source="{DynamicResource VOBackground01}" Stretch="UniformToFill"/>
						</Grid>

						<!-- Background -->
						<Border x:Name="headerBar" Background="{DynamicResource VOColor10}" Opacity="0.35" CornerRadius="1"/>

						<!-- ViewOn.tv -->
						<StackPanel Orientation="Horizontal" Margin="3,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
							<TextBlock x:Name="txtViewOnTv" Cursor="Hand" Margin="3,0,0,0" VerticalAlignment="Center" Foreground="{DynamicResource VOColorText}" FontFamily="Tahoma" FontSize="10" Text="ViewOn.Tv">
								<TextBlock.BitmapEffect>
									<OuterGlowBitmapEffect GlowColor="{Binding Source={x:Static host:Host.UIService}, Path=GlowColors.VOGColor1A}" GlowSize="3" Noise="0" Opacity="0.5" />
								</TextBlock.BitmapEffect>
							</TextBlock>
						</StackPanel>

						<!-- Window buttons -->
						<Grid Margin="0,5,0,4" Grid.Row="0">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="1" />
								<ColumnDefinition Width="1" />
								<ColumnDefinition Width="*" />
							</Grid.ColumnDefinitions>

							<StackPanel Margin="0,0,10,0" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" Grid.Column="2">
								<Button Name="btnSettings" Style="{DynamicResource Button.TransparentWithEffect4}" Cursor="Hand">
									<TextBlock Text="{x:Static properties:Globalization.TvWindow_Settings}" FontWeight="Bold" Foreground="{DynamicResource VOColorIcon}"/>
								</Button>
								<TextBlock Text=" | " Foreground="{DynamicResource VOColorIcon}" Margin="0,0,30,0"/>
								<Button Name="colorSelector" Style="{DynamicResource WindowBarButton}">
									<Ellipse
																			Height="7"
																			Width="7"
																			Stroke="{DynamicResource VOColor02}"
																			StrokeThickness="2" />
								</Button>
								<Button Name="miniMode" Style="{DynamicResource WindowBarButton}">
									<Polygon
																				Points="2,2 8,2 5,5"
																				Fill="{DynamicResource VOColorIcon}"
																				Stroke="{DynamicResource VOColorIcon}"
																				StrokeThickness="1" />
								</Button>
								<Button Name="minimize" Style="{DynamicResource WindowBarButton}">
									<Viewbox>
										<Canvas Height="10" Width="10">
											<Rectangle Height="1" Width="10" Fill="{DynamicResource VOColorIcon}" Canvas.Left="0" Canvas.Top="9" />
										</Canvas>
									</Viewbox>
								</Button>
								<Button Name="maximize" Style="{DynamicResource WindowBarButton}">
									<Viewbox>
										<Canvas Height="10" Width="12" Name="maximizeCanvas">
											<Path Data="M18.984,3L18.984,12.984 29.031,12.984 29.031,3 18.984,3z M28.016,11.984L20,11.984 20,6.016 28.016,6.016 28.016,11.984z" Visibility="Hidden" Fill="{DynamicResource VOColorIcon}" Name="maximizeBox2" Canvas.Left="-17" Canvas.Top="-5" />
											<Path Data="M18.984,3L18.984,12.984 29.031,12.984 29.031,3 18.984,3z M28.016,11.984L20,11.984 20,6.016 28.016,6.016 28.016,11.984z" Fill="{DynamicResource VOColorIcon}" Name="maximizeBox1" Canvas.Left="-18" Canvas.Top="-2" />
										</Canvas>
									</Viewbox>
								</Button>
								<Button Name="close" Style="{DynamicResource WindowBarButton}">
									<Viewbox>
										<Canvas Height="10" Width="10">
											<Line Fill="{DynamicResource VOColor1A}" X2="9" X1="1" Stroke="{DynamicResource VOColorIcon}" StrokeThickness="1.5" Y2="9" Y1="1" />
											<Line Fill="{DynamicResource VOColor1A}" X2="1" X1="9" Stroke="{DynamicResource VOColorIcon}" StrokeThickness="1.5" Y2="9" Y1="1" />
										</Canvas>
									</Viewbox>
								</Button>
							</StackPanel>
						</Grid>

						<Canvas
														x:Name="childWindowsCanvas"
														Background="#00FFFFFF"
														HorizontalAlignment="Stretch"
														VerticalAlignment="Stretch"
														Grid.Row="1">
							<AdornerDecorator Grid.Row="1">
								<ContentPresenter x:Name="contentPresenter"/>
							</AdornerDecorator>
						</Canvas>

						<Border Name="windowBorder" Grid.Row="0" Grid.RowSpan="2" BorderBrush="{DynamicResource VOColor19}" BorderThickness="1"/>

						<!-- Grip -->
						<Grid Grid.RowSpan="2">
							<Line Name="lnSizeNorth"
															  Stroke="Transparent" StrokeThickness="2" Cursor="SizeNS"
															  X1="1" X2="{Binding ElementName=ThisWindow, Path=ActualWidth}"
															  Y1="1" Y2="1"/>

							<Line Name="lnSizeSouth"
															  Stroke="Transparent" StrokeThickness="2" VerticalAlignment="Bottom" Cursor="SizeNS"
															  X1="1" X2="{Binding ElementName=ThisWindow, Path=ActualWidth}"
															  Y1="{Binding ElementName=ThisWindow, Path=ActuelHeight}" Y2="{Binding ElementName=ThisWindow, Path=ActuelHeight}"/>

							<Line Name="lnSizeWest"
															  Stroke="Transparent" Cursor="SizeWE" StrokeThickness="2"
															  X1="1" X2="1"
															  Y1="1" Y2="{Binding ElementName=ThisWindow, Path=ActualHeight}"/>

							<Line Name="lnSizeEast"
															  Stroke="Transparent" StrokeThickness="2" HorizontalAlignment="Right" Cursor="SizeWE"
															  X1="{Binding ElementName=ThisWindow, Path=ActualWidth}" X2="{Binding ElementName=ThisWindow, Path=ActualWidth}"
															  Y1="1" Y2="{Binding ElementName=ThisWindow, Path=ActualHeight}"/>

							<Rectangle Name="rectSizeNorthWest" Cursor="SizeNWSE" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Top" HorizontalAlignment="Left" />
							<Rectangle Name="rectSizeNorthEast" Cursor="SizeNESW" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Top" HorizontalAlignment="Right" />
							<Rectangle Name="rectSizeSouthWest" Cursor="SizeNESW" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
							<Rectangle Name="rectSizeSouthEast" Cursor="SizeNWSE" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
						</Grid>

					</Grid>

				</ControlTemplate>

			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>